#pragma once
// -------------------------------------------------
// BlinKit - BlinKit Library
// -------------------------------------------------
//   File Name: prototype_traits.h
// Description: Prototype Traits
//      Author: Ziming Li
//     Created: 2022-03-14
// -------------------------------------------------
// Copyright (C) 2022 MingYang Software Technology.
// -------------------------------------------------

#ifndef BLINKIT_PROTOTYPE_TRAITS_H
#define BLINKIT_PROTOTYPE_TRAITS_H

namespace blink {
class Comment;
class DOMTokenList;
class Document;
class DocumentFragment;
class HTMLCollection;
class Location;
class Navigator;
class NodeList;
class Text;
#ifdef BLINKIT_UI_ENABLED
class ClientRect;
class CSSStyleDeclaration;
class Screen;
class ShadowRoot;
class StyleSheetList;
#endif
}

namespace BlinKit {
namespace qjs {

enum Prototypes {
    PROTO_Window = 0,
    PROTO_Document,
    PROTO_Element,
    PROTO_Text,
    PROTO_DocumentFragment,
    PROTO_Comment,

    PROTO_DOMTokenList,
    PROTO_Event,
    PROTO_HTMLCollection,
    PROTO_Location,
    PROTO_Navigator,
    PROTO_NodeList,

#ifdef BLINKIT_UI_ENABLED
    PROTO_ClientRect,
    PROTO_CSSStyleDeclaration,
    PROTO_Screen,
    PROTO_ShadowRoot,
    PROTO_StyleSheetList,
#endif

    PROTO_MAX
};

template <class T>
struct PrototypeTrait {
};

template <>
struct PrototypeTrait<blink::Comment> {
    constexpr static int PROTO = PROTO_Comment;
};

template <>
struct PrototypeTrait<blink::DOMTokenList> {
    constexpr static int PROTO = PROTO_DOMTokenList;
};

template <>
struct PrototypeTrait<blink::Document> {
    constexpr static int PROTO = PROTO_Document;
};

template <>
struct PrototypeTrait<blink::DocumentFragment> {
    constexpr static int PROTO = PROTO_DocumentFragment;
};

template <>
struct PrototypeTrait<blink::HTMLCollection> {
    constexpr static int PROTO = PROTO_HTMLCollection;
};

template <>
struct PrototypeTrait<blink::Location> {
    constexpr static int PROTO = PROTO_Location;
};

template <>
struct PrototypeTrait<blink::Navigator> {
    constexpr static int PROTO = PROTO_Navigator;
};

template <>
struct PrototypeTrait<blink::NodeList> {
    constexpr static int PROTO = PROTO_NodeList;
};

template <>
struct PrototypeTrait<blink::Text> {
    constexpr static int PROTO = PROTO_Text;
};

#ifdef BLINKIT_UI_ENABLED
template <>
struct PrototypeTrait<blink::ClientRect> {
    constexpr static int PROTO = PROTO_ClientRect;
};

template <>
struct PrototypeTrait<blink::CSSStyleDeclaration> {
    constexpr static int PROTO = PROTO_CSSStyleDeclaration;
};

template <>
struct PrototypeTrait<blink::ShadowRoot> {
    constexpr static int PROTO = PROTO_ShadowRoot;
};

template <>
struct PrototypeTrait<blink::Screen> {
    constexpr static int PROTO = PROTO_Screen;
};

template <>
struct PrototypeTrait<blink::StyleSheetList> {
    constexpr static int PROTO = PROTO_StyleSheetList;
};
#endif

} // namespace qjs
} // namespace BlinKit

#endif // BLINKIT_PROTOTYPE_TRAITS_H
